package tr.helper.domain;

import lombok.Builder;
import lombok.Data;
import tr.helper.auth.GoogleAuthenticatorUtils;

/**
 * tr-service
 *
 * @author MrYe
 * @date 2022-01-13 16:00
 */
@Builder
@Data
public class LoginRequest {

    private String email;
    private String password;
    private String captcha;
    /**
     * 安全码
     */
    private String sec;

    @Override
    public String toString() {
        String data = "email=" + this.email + "&password=" + this.password;
        if (null != this.captcha) {
            data += "&captcha=" + this.captcha;
        }
        if (null != this.sec) {
            data += "&totp=" + GoogleAuthenticatorUtils.getTOTPCode(sec);
        }
        System.out.println("=====> email:" + email+"\tsec:"+ sec + "\ncode:"+data);
        return data;
    }

}
